/*
 * Copyright © 2010 SenseForce.com.
 * The Software shall be used for Good, not Evil.
 */

package com.senseforce.midlets;

import com.senseforce.classes.TestThreads;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 * @author jcccn
 * @site http://www.senseforce.com/
 */
public class StartThread extends MIDlet implements CommandListener {
    private Display display;
    private Form mainForm;
    private Command showC;
    private Command exitC;
    public void startApp() {
        display = Display.getDisplay(this);
        mainForm = new Form("Threads Test");
        showC = new Command("Show", Command.ITEM, 0);
        exitC = new Command("Exit", Command.EXIT, 0);
        mainForm.addCommand(showC);
        mainForm.addCommand(exitC);
        mainForm.setCommandListener(this);
        display.setCurrent(mainForm);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if (c == showC) {
            TestThreads.test(null);
        }
        if (c == exitC) {
            try {
                destroyApp(true);
            } catch (Exception e) {
            }
            notifyDestroyed();
        }
    }
}
